package patterns.absfactory;

/**
 * Created by lenovo on 2016/11/22 0022.
 * 工厂类的创造器，用于创造AbstractFactory的子类对象。多态形式
 */
public class FactoryProducer {
    //根据调用者的要求，提供不同的工厂模式
    public static AbstractFactory getFactory(String mode){
        if (mode == null){
            return null;
        }
        if (mode.equalsIgnoreCase("SHAPE")){
            return new ShapeFactory();
        }else if (mode.equalsIgnoreCase("COLOR")){
            return new ColorFactory();
        }
        return null;
    }
}
